//
//  ScienceTableViewCell.m
//  XFXnews
//
//  Created by dllo on 16/2/26.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "XFXScienceTableViewCell.h"

@interface XFXScienceTableViewCell ()

@property (nonatomic, retain) UILabel *title;
@property (nonatomic, retain) UILabel *digest;
@property (nonatomic, retain) UILabel *replyCount;
@property (nonatomic, retain) UIImageView *myImageView;

@end

@implementation XFXScienceTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }return self;
}

- (void)createSubViews{
    
    self.myImageView = [[UIImageView alloc] initWithFrame:CGRectMake(XFXWIDTH * 0.02, XFXWIDTH * 0.02, XFXWIDTH * 0.33, XFXHEIGHT * 0.16)];
    [self.contentView addSubview:self.myImageView];
    
    self.title = [[UILabel alloc] initWithFrame:CGRectMake(self.myImageView.frame.origin.x + self.myImageView.frame.size.width + 6 * XFXSWID, self.myImageView.frame.origin.y + 15 * XFXSHEI, XFXWIDTH, XFXHEIGHT * 0.02)];
    self.title.text = @"111";
    self.title.font = [UIFont systemFontOfSize:13.0];
    [self.contentView addSubview:self.title];
    
    self.digest = [[UILabel alloc] initWithFrame:CGRectMake(self.title.frame.origin.x, self.title.frame.origin.y + 20 * XFXSWID, XFXWIDTH * 0.6, XFXHEIGHT * 0.07)];
    self.digest.text  = @"2222";
    self.digest.font = [UIFont systemFontOfSize:12.0];
    self.digest.numberOfLines = 0;
    [self.contentView addSubview:self.digest];
    
    self.replyCount = [[UILabel alloc] initWithFrame:CGRectMake(XFXWIDTH - 70 * XFXSWID, self.digest.frame.size.height + self.digest.frame.origin.y * XFXSHEI, XFXWIDTH, XFXHEIGHT * 0.02)];
    self.replyCount.text = @"5210";
    self.replyCount.font = [UIFont systemFontOfSize:13.0];
    [self.contentView addSubview:self.replyCount];
    
}

-(void)setModel:(XFXNewsHeadLineModel *)model{
    
    _model = model;
    self.title.text = _model.title;
    self.digest.text = _model.digest;
    self.replyCount.text = [NSString stringWithFormat:@"%@跟帖",_model.replyCount];
    NSURL *url = [NSURL URLWithString:_model.imgsrc];
    [self.myImageView sd_setImageWithURL:url placeholderImage:nil];
    
}



@end
